package com.example.android;

import static com.example.android.constants.Constants.EXAM_URL;

import androidx.annotation.LongDef;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.example.android.databinding.Activity4Binding;
import com.example.android.util.HttpUtil;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public class Activity4 extends AppCompatActivity {

    Activity4Binding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = Activity4Binding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        HttpUtil.sendOkHttpRequest(EXAM_URL, new Callback() {
            @Override
            public void onFailure(@NonNull Call call, @NonNull IOException e) {
                Log.d("TAG", "onFailure: " + e.getLocalizedMessage());
            }

            @Override
            public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
                String strJson = response.body().string();
                Log.d("TAG",strJson);
            }
        });
    }
}